.class public Les/xc;
.super Ljava/lang/Object;
.source "ThreadPool.java"


# static fields
.field public static a:I = 0x1

.field private static b:Les/vc;

.field private static c:Landroid/os/Handler;

.field private static d:Landroid/os/HandlerThread;

.field private static e:Landroid/os/Handler;

.field private static final f:Z


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .line 1
    new-instance v0, Ljava/util/concurrent/ScheduledThreadPoolExecutor;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/concurrent/ScheduledThreadPoolExecutor;-><init>(I)V

    const/4 v0, 0x0

    .line 2
    sput-object v0, Les/xc;->c:Landroid/os/Handler;

    .line 3
    sput-object v0, Les/xc;->d:Landroid/os/HandlerThread;

    .line 4
    sput-object v0, Les/xc;->e:Landroid/os/Handler;

    .line 5
    sget-boolean v0, Les/u6;->a:Z

    sput-boolean v0, Les/xc;->f:Z

    return-void
.end method

.method public static a()V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalStateException;
        }
    .end annotation

    .line 12
    invoke-static {}, Les/xc;->b()Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 13
    :cond_0
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string v1, "ensureUiThread: thread check failed"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public static a(Ljava/lang/Runnable;)V
    .locals 2

    .line 1
    sget-object v0, Les/xc;->b:Les/vc;

    if-nez v0, :cond_0

    return-void

    .line 2
    :cond_0
    sget-boolean v1, Les/xc;->f:Z

    if-eqz v1, :cond_1

    .line 3
    new-instance v1, Les/wc;

    invoke-direct {v1, p0}, Les/wc;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0, v1}, Les/vc;->execute(Ljava/lang/Runnable;)V

    goto :goto_0

    .line 4
    :cond_1
    invoke-virtual {v0, p0}, Les/vc;->execute(Ljava/lang/Runnable;)V

    :goto_0
    return-void
.end method

.method public static a(Ljava/lang/Runnable;I)V
    .locals 3

    .line 9
    sget-boolean v0, Les/xc;->f:Z

    if-eqz v0, :cond_0

    .line 10
    sget-object v0, Les/xc;->e:Landroid/os/Handler;

    new-instance v1, Les/wc;

    invoke-direct {v1, p0}, Les/wc;-><init>(Ljava/lang/Runnable;)V

    int-to-long p0, p1

    invoke-virtual {v0, v1, p0, p1}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    goto :goto_0

    .line 11
    :cond_0
    sget-object v0, Les/xc;->e:Landroid/os/Handler;

    int-to-long v1, p1

    invoke-virtual {v0, p0, v1, v2}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    :goto_0
    return-void
.end method

.method public static a(Ljava/lang/Runnable;J)V
    .locals 2

    .line 5
    sget-object v0, Les/xc;->c:Landroid/os/Handler;

    if-nez v0, :cond_0

    return-void

    .line 6
    :cond_0
    sget-boolean v1, Les/xc;->f:Z

    if-eqz v1, :cond_1

    .line 7
    invoke-virtual {v0, p0, p1, p2}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    goto :goto_0

    .line 8
    :cond_1
    invoke-virtual {v0, p0, p1, p2}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    :goto_0
    return-void
.end method

.method public static b(Ljava/lang/Runnable;)V
    .locals 2

    .line 1
    sget-object v0, Les/xc;->c:Landroid/os/Handler;

    if-eqz v0, :cond_2

    if-nez p0, :cond_0

    goto :goto_0

    .line 2
    :cond_0
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Looper;->getThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v1

    if-ne v0, v1, :cond_1

    .line 3
    invoke-interface {p0}, Ljava/lang/Runnable;->run()V

    goto :goto_0

    .line 4
    :cond_1
    sget-object v0, Les/xc;->c:Landroid/os/Handler;

    invoke-virtual {v0, p0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    :cond_2
    :goto_0
    return-void
.end method

.method public static b()Z
    .locals 2

    .line 5
    invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;

    move-result-object v0

    .line 6
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v1

    .line 7
    invoke-virtual {v1, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public static c()V
    .locals 9

    .line 1
    invoke-static {}, Les/xc;->a()V

    .line 2
    sget v0, Les/xc;->a:I

    const/4 v1, 0x2

    invoke-static {v1, v0}, Ljava/lang/Math;->max(II)I

    move-result v4

    .line 3
    sget v0, Les/xc;->a:I

    const/4 v8, 0x4

    mul-int/lit8 v0, v0, 0x4

    add-int/lit8 v5, v0, 0x2

    .line 4
    new-instance v0, Les/vc;

    new-instance v3, Ljava/util/concurrent/LinkedBlockingQueue;

    invoke-direct {v3}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V

    const/4 v6, 0x0

    const/4 v7, 0x2

    move-object v2, v0

    invoke-direct/range {v2 .. v7}, Les/vc;-><init>(Ljava/util/Queue;IIII)V

    sput-object v0, Les/xc;->b:Les/vc;

    .line 5
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    sput-object v0, Les/xc;->c:Landroid/os/Handler;

    .line 6
    new-instance v0, Landroid/os/HandlerThread;

    const-string v1, "internal"

    invoke-direct {v0, v1}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    sput-object v0, Les/xc;->d:Landroid/os/HandlerThread;

    .line 7
    invoke-virtual {v0, v8}, Landroid/os/HandlerThread;->setPriority(I)V

    .line 8
    sget-object v0, Les/xc;->d:Landroid/os/HandlerThread;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

    .line 9
    new-instance v0, Landroid/os/Handler;

    sget-object v1, Les/xc;->d:Landroid/os/HandlerThread;

    invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    sput-object v0, Les/xc;->e:Landroid/os/Handler;

    return-void
.end method
